<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
    <title>用户订单界面</title>
</head>
<?php
include_once("inc.php");
include_once("base.php");
$tb_name = "orders";
$id = !empty($_GET['id']) ? intval($_GET['id']) : '';
$row = db_get_row("select * from $tb_name where id='".$id."'");
?>
<body>
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td width="17" rowspan="2" valign="top" bgcolor="#FFFFFF"></td>
			<td valign="top">
				<table width="100%" height="31" border="0" cellpadding="0" cellspacing="0">
					<tr bgcolor="#FFFFFF">
						<td height="31">
							<div class="title">订单管理</div>
						</td>
					</tr>
				</table>
			</td>
			<td width="16" rowspan="2" bgcolor="#FFFFFF"></td>
		</tr>
		<tr>
			<td valign="top" bgcolor="#F7F8F9">
				<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
					<tr>
						<td colspan="4" height="10"></td>
					</tr>
					<tr>
						<td width="1%">&nbsp;</td>
						<td width="96%">
							<table width="100%" class="cont">
								<tr>
									<td width="1%"></td>
									<td>订单编号:<?php echo $row['onumber'];?></td>
								</tr>
							</table>
						</td>
						<td width="1%">&nbsp;</td>
					</tr>
					<tr>
						<td width="1%">&nbsp;</td>
						<td width="96%">
							<form name="form1" method="post" action="" onSubmit="return checkadd()">
								<input type="hidden" name="ordersid" value="<?php echo $row["id"];?>"/>
								<table width="100%">
									<td colspan="2">
										<table width="100%" class="cont tr_color">
											<tr>
												<th>商品名称</th>
												<th>数量</th>
												<th>成交价</th>
												<th>小 计</th>
												<th>状态</th>
											</tr>
											<?php 
											$total = 0;
											$ordersta = db_get_all("select * from ordersta where ordersid=".$row['id']." order by id desc");
											foreach($ordersta as $ordersrow) {
												$row1=db_get_row("select * from goods where id=".$ordersrow['goodsid']);
												?>
												<input type="hidden" name="orderstaid[]" value="<?php echo $ordersrow["id"];?>"/>
												<tr align="center" class="d">
													<td>
														<a href="../goodsshow.php?id=<?php echo $row1['id'];?>" target="_blank"><?php echo $row1['title'];?></a>
													</td>
													<td align="center"><?php echo $ordersrow['nums'];?></td>
													<td align="center"><?php echo $ordersrow['price'];?></td>
													<td align="center"><?php echo $ordersrow['price']*$ordersrow['nums'];?></td>
													<td>
														<?php echo $ordersrow['zt'];?>
														<?php 
														if($ordersrow['zt']=="已发货" ){
														?>
														<a href="ordersave.php?act=shouhuo&orderstaid=<?php echo $ordersrow['id']?>&ordersid=<?php echo $row['id']?>" class="details">
															<button type="button" class="tbutton">确认收货</button>
														</a>
														<?php }?>
<!-- 														<?php 
														if($row['zt']=="已付款"&&$row['shfs']!="配送" ){
															?>
															<a href="ordersave.php?act=shouhuo&orderstaid=<?php echo $ordersrow['id']?>&ordersid=<?php echo $row['id']?>" class="details">
																<button type="button" class="tbutton">确认收货</button>
															</a>
														<?php }?> -->
													</td>
												</tr>
											<?php } ?>
										</table>
									</td>
									<!-- </tr> -->
								</table>
								<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="cont">
									<tr bgcolor="#cecece">
										<td height="35" colspan="2" align="center">订单信息</td>
									</tr>
									<tr>
										<td width="120" height="25" align="right">姓名：</td>
										<td width="627"><?php echo $row['nickname'];?></td>
									</tr>
									<tr>
										<td height="25" align="right">详细地址：</td>
										<td height="25"><?php echo $row['address'];?></td>
									</tr>
									<tr>
										<td height="25" align="right">电　　话：</td>
										<td height="25"><?php echo $row['tel'];?></td>
									</tr>
									<tr>
										<td height="25" align="right">支付方式：</td>
										<td height="25"><?php echo $row['zffs'];?></td>
									</tr>
									<tr>
										<td height="25" align="right">送货方式：</td>
										<td height="25"><?php echo $row['shfs'];?></td>
									</tr>
									<?php 
									if($row['pic']){
										?>
										<tr>
											<td height="25" align="right">配送信息：</td>
											<td height="25"><?php echo $row['kuaidi'];?>-<?php echo $row['pic_tel'];?></td>
										</tr>
									<?php }?>
									<tr>
										<td height="25" align="right">简单留言：</td>
										<td height="25"><?php echo $row['content'];?></td>
									</tr>
									<tr>
										<td height="25" colspan="2" align="center">
											&nbsp;&nbsp;
											<?php
											if($row['zt']=="未付款"){
												?>
												<a href="ordersave.php?act=zhifu&ordersid=<?php echo $row['id']?>" class="details">
												<button type="button" class="tbutton">点击支付</button>
												</a>
											<?php } ?>
										</td>
									</tr>
								</table>
								<table width="100%" cellPadding="6" bgcolor="#cecece" class="table table-bordered">
									<tr>
										<td height="20" align="center">
											<input name="button" type="button" class="btn" onClick="window.location.href='orders_list.php'" value="返回">
										</td>
									</tr>
								</table>
							</form>
						</td><td width="1%">&nbsp;</td>
					</tr>
					<tr><td height="20"></td></tr>
				</table>
			</td>
		</tr>
	</table>
</body>
</html>